perm filename GFTYPE.TEX[MF,ALS]1 blob sn#764515 filedate 1984-08-08 generic text, type T, neo UTF8
\input webmac
% This program by D. R. Fuchs is not copyrighted and can be used freely.
% Version 0 was implemented in March 1984, before METAFONT itself was complete.
% Version 1 incorporated refinements suitable for the TRAP test (August 1984).

% Here is TeX material that gets inserted after \input webmac
\def\hang{\hangindent 3em\noindent\ignorespaces}
\def\textindent#1{\hangindent2.5em\noindent\hbox to2.5em{\hss#1 }\ignorespaces}
\font\ninerm=amr9
\let\mc=\ninerm % medium caps for names like PASCAL
\font\tenss=amss10 % for `The METAFONTbook'
\def\PASCAL{{\mc PASCAL}}
\def\ph{{\mc PASCAL-H}}
\font\logo=manfnt % font used for the METAFONT logo
\def\MF{{\logo META}\-{\logo FONT}}
\def\<#1>{$\langle#1\rangle$}
\def\section{\mathhexbox278}
\let\swap=\leftrightarrow
\def\round{\mathop{\rm round}\nolimits}

\def\(#1){} % this is used to make section names sort themselves better
\def\9#1{} % this is used for sort keys in the index via @:sort key}{entry@>

\def\title{GFtype}
\def\topofcontents{\null
	\def\titlepage{F} % include headline on the contents page
	\def\rheader{\mainfont\hfil \contentspagenumber}
	\vfill
	\centerline{\titlefont The {\ttitlefont GFtype} processor}
	\vskip 15pt
	\centerline{(Version 1.0, August 1984)}
	\vfill}
\def\botofcontents{\vfill
	\centerline{\hsize 5in\baselineskip9pt
		\vbox{\ninerm\noindent
		The preparation of this report
		was supported in part by the National Science
		Foundation under grants IST-8201926 and MCS-8300984,
		and by the System Development Foundation. `\TeX' is a
		trademark of the American Mathematical Society.}}}
\pageno=\contentspagenumber \advance\pageno by 1

\N1.  Introduction.
The \.{GFtype} utility program reads binary generic-font (``\.{GF}'')
files that are produced by font compilers such as \MF, and converts them
into symbolic form. This program has two chief purposes: (1)~It can be used to
determine whether a \.{GF} file is valid or invalid, when diagnosing
compiler errors; and (2)~it serves as an example of a program that reads
\.{GF} files correctly, for system programmers who are developing
\.{GF}-related software.

The original version of this program was written by David R. Fuchs in
March, 1984. Donald E. Knuth made a few modifications later that year as
\MF\ was taking shape.

The \\{banner} string defined here should be changed whenever \.{GFtype}
gets modified.

\Y\P\D \37$\\{banner}\S\.{\'This\ is\ GFtype,\ Version\ 1.0\'}$\C{printed when
the program starts}\par
\fi

\M2. This program is written in standard \PASCAL, except where it is
necessary to use extensions; for example, one extension is to use a
default   \&{case}  as in \.{TANGLE}, \.{WEAVE}, etc.  All places where
nonstandard constructions are used have been listed in the index under
``system dependencies.''

\Y\P\D \37$\\{othercases}\S\\{others}$: \37\C{default for cases not listed
explicitly}\par
\P\D \37$\\{endcases}\S$\ \&{end} \C{follows the default case in an extended   %
\&{case}  statement}\par
\P\F \37$\\{othercases}\S\\{else}$\par
\P\F \37$\\{endcases}\S\\{end}$\par
\fi

\M3. The binary input comes from \\{gf\_file}, and the symbolic output is
written
on \PASCAL's standard \\{output} file. The term \\{print} is used instead of
\\{write} when this program writes on \\{output}, so that all such output
could easily be redirected if desired.

\Y\P\D \37$\\{print}(\#)\S\\{write}(\#)$\par
\P\D \37$\\{print\_ln}(\#)\S\\{write\_ln}(\#)$\par
\P\D \37$\\{print\_nl}\S\\{write\_ln}$\par
\Y\P\4\&{program}\1\  \37$\\{GF\_type}(\\{gf\_file},\39\\{output})$;\6
\4\&{label} \37\X4:Labels in the outer block\X\6
\4\&{const} \37\X5:Constants in the outer block\X\6
\4\&{type} \37\X8:Types in the outer block\X\6
\4\&{var} \37\X10:Globals in the outer block\X\6
\4\&{procedure}\1\  \37\\{initialize};\C{this procedure gets things started
properly}\6
\4\&{var} \37\|i: \37\\{integer};\C{loop index for initializations}\2\6
\&{begin} \37$\\{print\_ln}(\\{banner})$;\6
\X11:Set initial values\X\6
\&{end};\par
\fi

\M4. If the program has to stop prematurely, it goes to the
`\\{final\_end}'.

\Y\P\D \37$\\{final\_end}=9999$\C{label for the end of it all}\par
\Y\P$\4\X4:Labels in the outer block\X\S$\6
\\{final\_end};\par
\U section~3.\fi

\M5. The following parameters can be changed at compile time to extend or
reduce \.{GFtype}'s capacity.

The total number of bits in the main \\{image\_array} will be
$$\hbox{$\\{top\_pixel}+1-\\{bot\_pixel}$ $\times$ $\\{right\_pixel}+1-\\{left%
\_pixel}$}.$$
(\MF's full pixel range is rarely implemented, because it would require
8~megabytes of memory.)

\Y\P$\4\X5:Constants in the outer block\X\S$\6
$\\{terminal\_line\_length}=150$;\C{maximum number of characters input in a
single 	line of input from the terminal}\6
$\\{line\_length}=79$;\C{\\{xxx} strings will not produce lines longer than
this}\6
$\\{top\_pixel}=69$;\C{upper boundary of pixel image of character}\6
$\\{bot\_pixel}=-10$;\C{lower boundary, ditto}\6
$\\{left\_pixel}=-10$;\C{left boundary, ditto}\6
$\\{right\_pixel}=69$;\C{guess what}\par
\U section~3.\fi

\M6. Here are some macros for common programming idioms.

\Y\P\D \37$\\{incr}(\#)\S\#\K\#+1$\C{increase a variable by unity}\par
\P\D \37$\\{decr}(\#)\S\#\K\#-1$\C{decrease a variable by unity}\par
\P\D \37$\\{negate}(\#)\S\#\K-\#$\C{change the sign of a variable}\par
\fi

\M7. If the \.{GF} file is badly malformed, the whole process must be aborted;
\.{GFtype} will give up, after issuing an error message about the symptoms
that were noticed.

Such errors might be discovered inside of subroutines inside of subroutines,
so a procedure called \\{jump\_out} has been introduced. This procedure, which
simply transfers control to the label \\{final\_end} at the end of the program,
contains the only non-local \&{goto}  statement in \.{GFtype}.

\Y\P\D \37$\\{abort}(\#)\S$\1\6
\&{begin} \37$\\{print}(\.{\'\ \'},\39\#)$;\5
\\{jump\_out};\6
\&{end}\2\par
\P\D \37$\\{bad\_gf}(\#)\S\\{abort}(\.{\'Bad\ GF\ file:\ \'},\39\#,\39\.{\'!%
\'})$\par
\Y\P\4\&{procedure}\1\  \37\\{jump\_out};\2\6
\&{begin} \37\&{goto} \37\\{final\_end};\6
\&{end};\par
\fi

\N8.  The character set.
Like all programs written with the  \.{WEB} system, \.{GFtype} can be
used with any character set. But it uses ASCII code internally, because
the programming for portable input-output is easier when a fixed internal
code is used.

The next few sections of \.{GFtype} have therefore been copied from the
analogous ones in the \.{WEB} system routines. They have been considerably
simplified, since \.{GFtype} need not deal with the controversial
ASCII codes less than \O{40}. If such codes appear in the \.{GF} file,
they will be printed as question marks.

\Y\P$\4\X8:Types in the outer block\X\S$\6
$\\{ASCII\_code}=\.{"\ "}\to\.{"\~"}$;\C{a subrange of the integers}\par
\A sections~9, 20, and~36.
\U section~3.\fi

\M9. The original \PASCAL\ compiler was designed in the late 60s, when six-bit
character sets were common, so it did not make provision for lower case
letters. Nowadays, of course, we need to deal with both upper and lower case
alphabets in a convenient way, especially in a program like \.{GFtype}.
So we shall assume that the \PASCAL\ system being used for \.{GFtype}
has a character set containing at least the standard visible characters
of ASCII code (\.{"!"} through \.{"\~"}).

Some \PASCAL\ compilers use the original name \\{char} for the data type
associated with the characters in text files, while other \PASCAL s
consider \\{char} to be a 64-element subrange of a larger data type that has
some other name.  In order to accommodate this difference, we shall use
the name \\{text\_char} to stand for the data type of the characters in the
output file.  We shall also assume that \\{text\_char} consists of
the elements $\\{chr}(\\{first\_text\_char})$ through $\\{chr}(\\{last\_text%
\_char})$,
inclusive. The following definitions should be adjusted if necessary.

\Y\P\D \37$\\{text\_char}\S\\{char}$\C{the data type of characters in text
files}\par
\P\D \37$\\{first\_text\_char}=0$\C{ordinal number of the smallest element of %
\\{text\_char}}\par
\P\D \37$\\{last\_text\_char}=127$\C{ordinal number of the largest element of %
\\{text\_char}}\par
\Y\P$\4\X8:Types in the outer block\X\mathrel{+}\S$\6
$\\{text\_file}=$\1\5
\&{packed} \37\&{file} \1\&{of}\5
\\{text\_char};\2\2\par
\fi

\M10. The \.{GFtype} processor converts between ASCII code and
the user's external character set by means of arrays \\{xord} and \\{xchr}
that are analogous to \PASCAL's \\{ord} and \\{chr} functions.

\Y\P$\4\X10:Globals in the outer block\X\S$\6
\4\\{xord}: \37\&{array} $[\\{text\_char}]$ \1\&{of}\5
\\{ASCII\_code};\C{specifies conversion of input characters}\2\6
\4\\{xchr}: \37\&{array} $[0\to255]$ \1\&{of}\5
\\{text\_char};\C{specifies conversion of output characters}\2\par
\A sections~21, 23, 25, 27, 35, 37, 40, 44, 52, 60, and~65.
\U section~3.\fi

\M11. Under our assumption that the visible characters of standard ASCII are
all present, the following assignment statements initialize the
\\{xchr} array properly, without needing any system-dependent changes.

\Y\P$\4\X11:Set initial values\X\S$\6
\&{for} $\|i\K0\mathrel{\&{to}}\O{37}$ \1\&{do}\5
$\\{xchr}[\|i]\K\.{\'?\'}$;\2\6
$\\{xchr}[\O{40}]\K\.{\'\ \'}$;\5
$\\{xchr}[\O{41}]\K\.{\'!\'}$;\5
$\\{xchr}[\O{42}]\K\.{\'"\'}$;\5
$\\{xchr}[\O{43}]\K\.{\'\#\'}$;\5
$\\{xchr}[\O{44}]\K\.{\'\$\'}$;\5
$\\{xchr}[\O{45}]\K\.{\'\%\'}$;\5
$\\{xchr}[\O{46}]\K\.{\'\&\'}$;\5
$\\{xchr}[\O{47}]\K\.{\'\'}\.{\'\'}$;\6
$\\{xchr}[\O{50}]\K\.{\'(\'}$;\5
$\\{xchr}[\O{51}]\K\.{\')\'}$;\5
$\\{xchr}[\O{52}]\K\.{\'*\'}$;\5
$\\{xchr}[\O{53}]\K\.{\'+\'}$;\5
$\\{xchr}[\O{54}]\K\.{\',\'}$;\5
$\\{xchr}[\O{55}]\K\.{\'-\'}$;\5
$\\{xchr}[\O{56}]\K\.{\'.\'}$;\5
$\\{xchr}[\O{57}]\K\.{\'/\'}$;\6
$\\{xchr}[\O{60}]\K\.{\'0\'}$;\5
$\\{xchr}[\O{61}]\K\.{\'1\'}$;\5
$\\{xchr}[\O{62}]\K\.{\'2\'}$;\5
$\\{xchr}[\O{63}]\K\.{\'3\'}$;\5
$\\{xchr}[\O{64}]\K\.{\'4\'}$;\5
$\\{xchr}[\O{65}]\K\.{\'5\'}$;\5
$\\{xchr}[\O{66}]\K\.{\'6\'}$;\5
$\\{xchr}[\O{67}]\K\.{\'7\'}$;\6
$\\{xchr}[\O{70}]\K\.{\'8\'}$;\5
$\\{xchr}[\O{71}]\K\.{\'9\'}$;\5
$\\{xchr}[\O{72}]\K\.{\':\'}$;\5
$\\{xchr}[\O{73}]\K\.{\';\'}$;\5
$\\{xchr}[\O{74}]\K\.{\'<\'}$;\5
$\\{xchr}[\O{75}]\K\.{\'=\'}$;\5
$\\{xchr}[\O{76}]\K\.{\'>\'}$;\5
$\\{xchr}[\O{77}]\K\.{\'?\'}$;\6
$\\{xchr}[\O{100}]\K\.{\'@\'}$;\5
$\\{xchr}[\O{101}]\K\.{\'A\'}$;\5
$\\{xchr}[\O{102}]\K\.{\'B\'}$;\5
$\\{xchr}[\O{103}]\K\.{\'C\'}$;\5
$\\{xchr}[\O{104}]\K\.{\'D\'}$;\5
$\\{xchr}[\O{105}]\K\.{\'E\'}$;\5
$\\{xchr}[\O{106}]\K\.{\'F\'}$;\5
$\\{xchr}[\O{107}]\K\.{\'G\'}$;\6
$\\{xchr}[\O{110}]\K\.{\'H\'}$;\5
$\\{xchr}[\O{111}]\K\.{\'I\'}$;\5
$\\{xchr}[\O{112}]\K\.{\'J\'}$;\5
$\\{xchr}[\O{113}]\K\.{\'K\'}$;\5
$\\{xchr}[\O{114}]\K\.{\'L\'}$;\5
$\\{xchr}[\O{115}]\K\.{\'M\'}$;\5
$\\{xchr}[\O{116}]\K\.{\'N\'}$;\5
$\\{xchr}[\O{117}]\K\.{\'O\'}$;\6
$\\{xchr}[\O{120}]\K\.{\'P\'}$;\5
$\\{xchr}[\O{121}]\K\.{\'Q\'}$;\5
$\\{xchr}[\O{122}]\K\.{\'R\'}$;\5
$\\{xchr}[\O{123}]\K\.{\'S\'}$;\5
$\\{xchr}[\O{124}]\K\.{\'T\'}$;\5
$\\{xchr}[\O{125}]\K\.{\'U\'}$;\5
$\\{xchr}[\O{126}]\K\.{\'V\'}$;\5
$\\{xchr}[\O{127}]\K\.{\'W\'}$;\6
$\\{xchr}[\O{130}]\K\.{\'X\'}$;\5
$\\{xchr}[\O{131}]\K\.{\'Y\'}$;\5
$\\{xchr}[\O{132}]\K\.{\'Z\'}$;\5
$\\{xchr}[\O{133}]\K\.{\'[\'}$;\5
$\\{xchr}[\O{134}]\K\.{\'\\\'}$;\5
$\\{xchr}[\O{135}]\K\.{\']\'}$;\5
$\\{xchr}[\O{136}]\K\.{\'\↑\'}$;\5
$\\{xchr}[\O{137}]\K\.{\'\_\'}$;\6
$\\{xchr}[\O{140}]\K\.{\'\`\'}$;\5
$\\{xchr}[\O{141}]\K\.{\'a\'}$;\5
$\\{xchr}[\O{142}]\K\.{\'b\'}$;\5
$\\{xchr}[\O{143}]\K\.{\'c\'}$;\5
$\\{xchr}[\O{144}]\K\.{\'d\'}$;\5
$\\{xchr}[\O{145}]\K\.{\'e\'}$;\5
$\\{xchr}[\O{146}]\K\.{\'f\'}$;\5
$\\{xchr}[\O{147}]\K\.{\'g\'}$;\6
$\\{xchr}[\O{150}]\K\.{\'h\'}$;\5
$\\{xchr}[\O{151}]\K\.{\'i\'}$;\5
$\\{xchr}[\O{152}]\K\.{\'j\'}$;\5
$\\{xchr}[\O{153}]\K\.{\'k\'}$;\5
$\\{xchr}[\O{154}]\K\.{\'l\'}$;\5
$\\{xchr}[\O{155}]\K\.{\'m\'}$;\5
$\\{xchr}[\O{156}]\K\.{\'n\'}$;\5
$\\{xchr}[\O{157}]\K\.{\'o\'}$;\6
$\\{xchr}[\O{160}]\K\.{\'p\'}$;\5
$\\{xchr}[\O{161}]\K\.{\'q\'}$;\5
$\\{xchr}[\O{162}]\K\.{\'r\'}$;\5
$\\{xchr}[\O{163}]\K\.{\'s\'}$;\5
$\\{xchr}[\O{164}]\K\.{\'t\'}$;\5
$\\{xchr}[\O{165}]\K\.{\'u\'}$;\5
$\\{xchr}[\O{166}]\K\.{\'v\'}$;\5
$\\{xchr}[\O{167}]\K\.{\'w\'}$;\6
$\\{xchr}[\O{170}]\K\.{\'x\'}$;\5
$\\{xchr}[\O{171}]\K\.{\'y\'}$;\5
$\\{xchr}[\O{172}]\K\.{\'z\'}$;\5
$\\{xchr}[\O{173}]\K\.{\'\{\'}$;\5
$\\{xchr}[\O{174}]\K\.{\'|\'}$;\5
$\\{xchr}[\O{175}]\K\.{\'\}\'}$;\5
$\\{xchr}[\O{176}]\K\.{\'\~\'}$;\6
\&{for} $\|i\K\O{177}\mathrel{\&{to}}255$ \1\&{do}\5
$\\{xchr}[\|i]\K\.{\'?\'}$;\2\par
\A sections~12, 26, 45, and~61.
\U section~3.\fi

\M12. The following system-independent code makes the \\{xord} array contain a
suitable inverse to the information in \\{xchr}.

\Y\P$\4\X11:Set initial values\X\mathrel{+}\S$\6
\&{for} $\|i\K\\{first\_text\_char}\mathrel{\&{to}}\\{last\_text\_char}$ \1%
\&{do}\5
$\\{xord}[\\{chr}(\|i)]\K\O{40}$;\2\6
\&{for} $\|i\K\.{"\ "}\mathrel{\&{to}}\.{"\~"}$ \1\&{do}\5
$\\{xord}[\\{xchr}[\|i]]\K\|i$;\2\par
\fi

\N13.  Generic font file format.
The most important output produced by a production run of \MF\ is the
``generic font'' (\.{GF}) file that specifies the bit patterns of the
characters that have been drawn. The term {\sl generic\/} indicates that
this file format doesn't match the conventions of any name-brand manufacturer;
but it is easy to convert \.{GF} files to the special format required by
almost all digital phototypesetting equipment. There's a strong analogy
between the \.{DVI} files written by \TeX\ and the \.{GF} files written
by \MF; and, in fact, the file formats have a lot in common.
It is therefore not surprising that \.{GFtype} is identical in many
respects to the \.{DVItype} program.

A \.{GF} file is a stream of 8-bit bytes that may be
regarded as a series of commands in a machine-like language. The first
byte of each command is the operation code, and this code is followed by
zero or more bytes that provide parameters to the command. The parameters
themselves may consist of several consecutive bytes; for example, the
`\\{boc}' (beginning of character) command has seven parameters, each of
which is four bytes long. Parameters are usually regarded as nonnegative
integers; but four-byte-long parameters can be either positive or
negative, hence they range in value from $-2↑{31}$ to $2↑{31}-1$.
As in \.{TFM} files, numbers that occupy
more than one byte position appear in BigEndian order,
and negative numbers appear in two's complement notation.

A \.{GF} file consists of a ``preamble,'' followed by a sequence of one or
more ``characters,'' followed by a ``postamble.'' The preamble is simply a
\\{pre} command, with its parameters that introduce the file; this must come
first.  Each ``character'' consists of a \\{boc} command, followed by any
number of other commands that specify ``black'' pixels,
followed by an \\{eoc} command. The characters appear in the order that \MF\
generated them. If we ignore no-op commands (which are allowed between any
two commands in the file), each \\{eoc} command is immediately followed by a
\\{boc} command, or by a \\{post} command; in the latter case, there are no
more characters in the file, and the remaining bytes form the postamble.
Further details about the postamble will be explained later.

Some parameters in \.{GF} commands are ``pointers.'' These are four-byte
quantities that give the location number of some other byte in the file;
the first file byte is number~0, then comes number~1, and so on.

\fi

\M14. The \.{GF} format is intended to be both compact and easily interpreted
by a machine. Compactness is achieved by making most of the information
relative instead of absolute. When a \.{GF}-reading program reads the
commands for a character, it keeps track of several quantities: (a)~the current
row number,~\|y; (b)~the current column number,~\|x; and (c)~the current
starting-column number,~\|z. These are 32-bit signed integers, although
most actual font formats produced from \.{GF} files will need to curtail
this vast range because of practical limitations. (\MF\ output will never
allow $\vert x\vert$, $\vert y\vert$, or $\vert z\vert$ to exceed 4095,
but the \.{GF} format tries to be more general.)

How do \.{GF}'s row and column numbers correspond to the conventions
of \TeX\ and \MF? Well, the ``reference point'' of a character, in \TeX's
view, is considered to be at the lower left corner of the pixel in row~0
and column~0. This point is the intersection of the baseline with the left
edge of the type; it corresponds to location $(0,0)$ in \MF\ programs.
Thus the pixel in row~0 and column~0 is \MF's unit square, comprising the
region of the plane whose coordinates both lie between 0 and~1. Negative
values of~\|y correspond to rows of pixels {\sl below\/} the baseline.
Negative values of~\|x correspond to columns of pixels {\sl left\/} of
the reference point.

Besides \|x, \|y, and \|z, there's also a fourth aspect of the current
state, namely the \\{paint\_switch}, which is always either \\{black} or
\\{white}. Each \\{paint} command advances \|x by a specified amount~\|d,
and blackens the intervening pixels if $\\{paint\_switch}=\\{black}$; then
the \\{paint\_switch} changes to the opposite state. \.{GF}'s commands are
designed so that \|x will never decrease within a row, and \|y will never
increase within a character; hence there is no way to whiten a pixel that
has been blackened.

\fi

\M15. Here is a list of all the commands that may appear in a \.{GF} file. Each
command is specified by its symbolic name (e.g., \\{boc}), its opcode byte
(e.g., 67), and its parameters (if any). The parameters are followed
by a bracketed number telling how many bytes they occupy; for example,
`$\|d[2]$' means that parameter \|d is two bytes long.

\yskip\hang\\{paint\_0} 0. This is a \\{paint} command with $\|d=0$; it does
nothing but change the \\{paint\_switch} from \\{black} to \\{white} or
vice~versa.

\yskip\hang\\{paint\_1} through \\{paint\_63} (opcodes 1 to 63).
These are \\{paint} commands with $\|d=1$ to~63, defined as follows: If
$\\{paint\_switch}=\\{black}$, blacken \|d~pixels of the current row~\|y,
in columns \|x through $\|x+\|d-1$ inclusive. Then, in any case,
complement the \\{paint\_switch} and advance \|x by~\|d.

\yskip\hang\\{paint1} 64 $\|d[1]$. This is a \\{paint} command with a specified
value of~\|d; \MF\ uses it to paint when $64\L\|d<256$.

\yskip\hang\\{paint2} 65 $\|d[2]$. Same as \\{paint1}, but \|d~can be as high
as~65535.

\yskip\hang\\{paint3} 66 $\|d[3]$. Same as \\{paint1}, but \|d~can be as high
as $2↑{24}-1$. \MF\ never needs this command, and it is hard to imagine
anybody making practical use of it; surely a more compact encoding will be
desirable when characters can be this large. But the command is there,
anyway, just in case.

\yskip\hang\\{boc} 67 $\|c[4]$ $\|p[4]$ $\\{min\_x}[4]$ $\\{max\_x}[4]$ $\\{min%
\_y}[4]$
$\\{max\_y}[4]$ $\|z[4]$. Beginning of a character:  Here \|c is the character
code, and \|p points to the previous \\{boc} command (if any) for characters
having this code number modulo 256.  (The pointer \|p is $-1$ if there was
no prior character with an equivalent code.) All $x$-coordinates of painted
pixels in the character that follows will be $\G\\{min\_x}$ and $\L\\{max\_x}$;
all
$y$-coordinates of painted pixels will be $\G\\{min\_y}$ and $\L\\{max\_y}$.
Finally,
\|z~is the leftmost potentially black column in row \\{max\_y}; it satisfies
$\\{min\_x}\L\|z\L\\{max\_x}$. When a \.{GF}-reading program sees a \\{boc}, it
can use
\\{min\_x}, \\{max\_x}, \\{min\_y}, and \\{max\_y} to initialize the bounds of
an
array. Then it sets $\|y\K\\{max\_y}$, $\\{paint\_switch}\K\\{black}$, and
initializes its
\|x and \|z registers both to the stated value of~\|z.

\yskip\hang\\{eoc} 68. End of character: All pixels blackened so far
constitute the pattern for this character. In particular, a completely
blank character might have \\{eoc} immediately following \\{boc}.

\yskip\hang\\{skip1} 69 $\|m[1]$. Decrease \|y by $\|m+1$, set $\|x\K\|z$, and
set
$\\{paint\_switch}\K\\{black}$. This is a way to produce \|m all-white rows.

\yskip\hang\\{skip2} 70 $\|m[2]$. Same as \\{skip1}, but \|m can be as large
as 65535.

\yskip\hang\\{skip3} 71 $\|m[3]$. Same as \\{skip1}, but \|m can be as large
as $2↑{24}-1$. \MF\ obviously never needs this command.

\yskip\hang\\{new\_row} 72 $\|u[4]$. Decrease \|y by 1 and set $\|z\K\|z+\|u$;
then set
$\|x\K\|z$ and $\\{paint\_switch}\K\\{black}$. (It's a general way to finish
one row
and begin another.)

\yskip\hang\\{left\_z\_83} through \\{left\_z\_1} (opcodes 73 to 155). Same as
\\{new\_row}, with $\|u=-83$ through $-1$, respectively.

\yskip\hang\\{right\_z\_0} 156. Same as \\{skip1} with $\|m=0$ or \\{new\_row}
with
$\|u=0$.

\yskip\hang\\{right\_z\_1} through \\{right\_z\_83} (opcodes 157 to 239). Same
as
\\{new\_row}, with $\|u=+1$ through $+83$, respectively. \MF\ generates a
\\{new\_row} command only when $\vert u\vert>83$.

\yskip\hang\\{nop} 240. No operation, do nothing. Any number of \\{nop}'s
may occur between \.{GF} commands, but a \\{nop} cannot be inserted between
a command and its parameters or between two parameters.

\yskip\hang\\{xxx1} 241 $\|k[1]$ $\|x[\|k]$. This command is undefined in
general; it functions as a $(k+2)$-byte \\{nop} unless special \.{GF}-reading
programs are being used. \MF\ generates \\{xxx} commands when encountering
a \&{special} string; this occurs in the \.{GF} file only between
characters, after the preamble, and before the postamble. However,
\\{xxx} commands might appear anywhere in \.{GF} files generated by other
processors. It is recommended that \|x be a string having the form of a
keyword followed by possible parameters relevant to that keyword.

\yskip\hang\\{xxx2} 242 $\|k[2]$ $\|x[\|k]$. Like \\{xxx1}, but $0\L\|k<65536$.

\yskip\hang\\{xxx3} 243 $\|k[3]$ $\|x[\|k]$. Like \\{xxx1}, but $0\L\|k<%
\hbox{$2↑{24}$}$.
\MF\ uses this when sending a \&{special} string whose length exceeds~255.

\yskip\hang\\{xxx4} 244 $\|k[4]$ $\|x[\|k]$. Like \\{xxx1}, but \|k can be
ridiculously large; \|k mustn't be negative.

\yskip\hang\\{yyy} 245 $\|n[4]$. This command is undefined in general;
it functions as a 5-byte \\{nop} unless special \.{GF}-reading programs
are being used. \MF\ puts scaled numbers into \\{yyy}'s, as a
result of \&{numspecial} commands; the intent is to provide numeric
parameters to \\{xxx} commands that immediately precede.

\yskip\hang\\{char\_loc} 246 $\|c[1]$ $\|v[4]$ $\|w[4]$ $\|p[4]$.
This command will appear only in the postamble, which will be explained
shortly.

\yskip\hang\\{pre} 247 $\|i[1]$ $\|k[1]$ $\|x[\|k]$.
Beginning of the preamble; this must come at the very beginning of the
file. Parameter \|i is an identifying number for \.{GF} format, currently
129. The other information is merely commentary; it is not given
special interpretation like \\{xxx} commands are. (Note that \\{xxx}
commands may immediately follow the preamble, before the first \\{boc}.)

\yskip\hang\\{post} 248. Beginning of the postamble, see below.

\yskip\hang\\{post\_post} 249. Ending of the postamble, see below.

\yskip\noindent Commands 250--255 are undefined at the present time.

\Y\P\D \37$\\{gf\_id\_byte}=129$\C{identifies the kind of \.{GF} files
described here}\par
\fi

\M16. Here are the opcodes \.{GFtype} actually refers to.

\Y\P\D \37$\\{paint\_0}=0$\C{beginning of the \\{paint} commands}\par
\P\D \37$\\{paint1}=64$\C{move right a given number of columns, then 	black${}%
\swap{}$white}\par
\P\D \37$\\{boc}=67$\C{beginning of a character}\par
\P\D \37$\\{eoc}=68$\C{end of a character}\par
\P\D \37$\\{skip1}=69$\C{skip over blank rows}\par
\P\D \37$\\{new\_row}=72$\C{move down one row and adjust \|z}\par
\P\D \37$\\{right\_z\_0}=156$\C{base of shorthand \\{new\_row} commands}\par
\P\D \37$\\{right\_z\_1}=157$\C{the next shorthand \\{new\_row} command}\par
\P\D \37$\\{right\_z\_83}=239$\C{the last shorthand \\{new\_row} command}\par
\P\D \37$\\{left\_z\_83}=73$\C{the first shorthand \\{new\_row} command}\par
\P\D \37$\\{nop}=240$\C{no operation}\par
\P\D \37$\\{xxx1}=241$\C{for \&{special} strings}\par
\P\D \37$\\{yyy}=245$\C{for \&{numspecial} numbers}\par
\P\D \37$\\{char\_loc}=246$\C{character locators in the postamble}\par
\P\D \37$\\{pre}=247$\C{preamble}\par
\P\D \37$\\{post}=248$\C{postamble beginning}\par
\P\D \37$\\{post\_post}=249$\C{postamble ending}\par
\P\D \37$\\{undefined\_commands}\S250,\39251,\39252,\39253,\39254,\39255$\par
\fi

\M17. The last character in a \.{GF} file is followed by `\\{post}'; this
command
introduces the postamble, which summarizes important facts that \MF\ has
accumulated. The postamble has the form
$$\vbox{\halign{\hbox{#\hfil}\cr
\\{post} $\|p[4]$ $\\{ds}[4]$ $\\{cs}[4]$ $\\{hppp}[4]$ $\\{vppp}[4]$
$\\{min\_x}[4]$ $\\{max\_x}[4]$ $\\{min\_y}[4]$ $\\{max\_y}[4]$\cr
$\langle\,$character locators$\,\rangle$\cr
\\{post\_post} $\|q[4]$ $\|i[1]$ 223's$[{\G}4]$\cr}}$$
Here \|p is a pointer to the byte following the final \\{eoc} in the file
(or to the byte following the preamble, if there are no characters);
it can be used to locate the beginning of \\{xxx} commands
that might have preceded the postamble. The \\{ds} and \\{cs} parameters
give the design size and check sum, respectively, which are exactly the
values put into the header of any \.{TFM} file that corresponds to this
\.{GF} file. Parameters \\{hppp} and \\{vppp} are the ratios of
pixels per point, horizontally and vertically, expressed as \\{scaled} integers
(i.e., multiplied by $2↑{16}$); they can be used to correlate the font
with specific device resolutions, magnifications, and ``at sizes.''  Then
come \\{min\_x}, \\{max\_x}, \\{min\_y}, and \\{max\_y}, which bound the values
that \|x
and~\|y assume in all painted pixels of the characters in this \.{GF} file.

\fi

\M18. Character locators are introduced by \\{char\_loc} commands,
which contain a character residue~\|c, a character device width~\|v,
a character width~\|w, and a pointer~\|p
to the beginning of that character. (If two or more characters have the
same code~\|c modulo 256, only the last will be indicated; the others can be
located by following backpointers. Characters whose codes differ by a
multiple of 256 are assumed to share the same font metric information,
hence the \.{TFM} file contains only residues of character codes modulo~256.
This convention is intended for oriental languages, when there are many
character shapes but few distinct widths.)

The character device width~\|v is the value of \MF's \&{chardw} parameter,
rounded to the nearest integer, i.e., the number of pixels that the font
designer wishes the character to occupy when it is typeset within a word.

The character width~\|w duplicates the information in the \.{TFM} file; it
is $2↑{24}$ times the ratio of the true width to the font's design size.

The backpointer \|p points to the character's \\{boc}, or to the first of
a sequence of consecutive \\{nop} or \\{xxx} or \\{yyy} commands that
immediately precede the \\{boc}, if such commands exist; such ``special''
commands essentially belong to the characters, while the special commands
after the final character belong to the postamble (i.e., to the font
as a whole). This convention about \|p applies also to the backpointers
in \\{boc} commands, even though it wasn't explained in the description
of~\\{boc}.

\fi

\M19. The last part of the postamble, following the \\{post\_post} byte that
signifies the end of the character locators, contains \|q, a pointer to the
\\{post} command that started the postamble.  An identification byte, \|i,
comes next; this currently equals~129, as in the preamble.

The \|i byte is followed by four or more bytes that are all equal to
the decimal number 223 (i.e., \O{337} in octal). \MF\ puts out four to seven of
these trailing bytes, until the total length of the file is a multiple of
four bytes, since this works out best on machines that pack four bytes per
word; but any number of 223's is allowed, as long as there are at least four
of them. In effect, 223 is a sort of signature that is added at the very end.

This curious way to finish off a \.{GF} file makes it feasible for
\.{GF}-reading programs to find the postamble first, on most computers,
even though \MF\ wants to write the postamble last. Most operating
systems permit random access to individual words or bytes of a file, so
the \.{GF} reader can start at the end and skip backwards over the 223's
until finding the identification byte. Then it can back up four bytes, read
\|q, and move to byte \|q of the file. This byte should, of course,
contain the value 248 (\\{post}); now the postamble can be read, so the
\.{GF} reader can discover all the information needed for individual
characters.

Unfortunately, however, standard \PASCAL\ does not include the ability to
access a random position in a file, or even to determine the length of a file.
Almost all systems nowadays provide the necessary capabilities, so \.{GF}
format has been designed to work most efficiently with modern operating
systems.
But if \.{GF} files have to be processed under the restrictions of standard
\PASCAL, one can simply read them from front to back. This will
be adequate for most applications. However, the postamble-first approach
would facilitate a program that merges two \.{GF} files, replacing data
from one that is overridden by corresponding data in the other.
\fi

\N20.  Input from binary files.
We have seen that a \.{GF} file is a sequence of 8-bit bytes. The bytes
appear physically in what is called a `\&{packed} \&{file} \&{of} $0\to255$'
in \PASCAL\ lingo.

Packing is system dependent, and many \PASCAL\ systems fail to implement
such files in a sensible way (at least, from the viewpoint of producing
good production software).  For example, some systems treat all
byte-oriented files as text, looking for end-of-line marks and such
things. Therefore some system-dependent code is often needed to deal with
binary files, even though most of the program in this section of
\.{GFtype} is written in standard \PASCAL.

We shall stick to simple \PASCAL\ in this program, for reasons of clarity,
even if such simplicity is sometimes unrealistic.

\Y\P$\4\X8:Types in the outer block\X\mathrel{+}\S$\6
$\\{eight\_bits}=0\to255$;\C{unsigned one-byte quantity}\6
$\\{byte\_file}=$\1\5
\&{packed} \37\&{file} \1\&{of}\5
\\{eight\_bits};\C{files that contain binary data}\2\2\par
\fi

\M21. The program deals with one binary file variable: \\{gf\_file} is the main
input file that we are translating into symbolic form.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{gf\_file}: \37\\{byte\_file};\C{the stuff we are \.{GF}typing}\par
\fi

\M22. To prepare this file for input, we \\{reset} it.

\Y\P\4\&{procedure}\1\  \37\\{open\_gf\_file};\C{prepares to read packed bytes
in \\{gf\_file}}\2\6
\&{begin} \37$\\{reset}(\\{gf\_file})$;\5
$\\{cur\_loc}\K0$;\6
\&{end};\par
\fi

\M23. If you looked carefully at the preceding code, you probably asked,
``What is \\{cur\_loc}?'' Good question. It's a global variable that holds
the number of the byte about to be read next from \\{gf\_file}.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{cur\_loc}: \37\\{integer};\C{where we are about to look, in \\{gf\_file}}%
\par
\fi

\M24. We shall use a set of simple functions to read the next byte or
bytes from \\{gf\_file}. There are four possibilities, each of which is
treated as a separate function in order to minimize the overhead for
subroutine calls.

\Y\P\4\&{function}\1\  \37\\{get\_byte}: \37\\{integer};\C{returns the next
byte, unsigned}\6
\4\&{var} \37\|b: \37\\{eight\_bits};\2\6
\&{begin} \37\&{if} $\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{get\_byte}\K0$\6
\4\&{else} \&{begin} \37$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{incr}(\\{cur\_loc})$;\5
$\\{get\_byte}\K\|b$;\6
\&{end};\2\6
\&{end};\7
\4\&{function}\1\  \37\\{get\_two\_bytes}: \37\\{integer};\C{returns the next
two bytes, unsigned}\6
\4\&{var} \37$\|a,\39\|b$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+2$;\5
$\\{get\_two\_bytes}\K\|a\ast256+\|b$;\6
\&{end};\7
\4\&{function}\1\  \37\\{get\_three\_bytes}: \37\\{integer};\C{returns the next
three bytes, unsigned}\6
\4\&{var} \37$\|a,\39\|b,\39\|c$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{read}(\\{gf\_file},\39\|c)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+3$;\5
$\\{get\_three\_bytes}\K(\|a\ast256+\|b)\ast256+\|c$;\6
\&{end};\7
\4\&{function}\1\  \37\\{signed\_quad}: \37\\{integer};\C{returns the next four
bytes, signed}\6
\4\&{var} \37$\|a,\39\|b,\39\|c,\39\|d$: \37\\{eight\_bits};\2\6
\&{begin} \37$\\{read}(\\{gf\_file},\39\|a)$;\5
$\\{read}(\\{gf\_file},\39\|b)$;\5
$\\{read}(\\{gf\_file},\39\|c)$;\5
$\\{read}(\\{gf\_file},\39\|d)$;\5
$\\{cur\_loc}\K\\{cur\_loc}+4$;\6
\&{if} $\|a<128$ \1\&{then}\5
$\\{signed\_quad}\K((\|a\ast256+\|b)\ast256+\|c)\ast256+\|d$\6
\4\&{else} $\\{signed\_quad}\K(((\|a-256)\ast256+\|b)\ast256+\|c)\ast256+\|d$;%
\2\6
\&{end};\par
\fi

\N25.  Optional modes of output.
\.{GFtype} will print different quantities of information based on some
options that the user must specify: We set \\{wants\_mnemonics} if the
user wants to see a mnemonic dump of the \.{GF} file; and we set
\\{wants\_pixels} if the user wants to see a pixel image of each
character.

When \.{GFtype} begins, it engages the user in a brief dialog so that the
options will be specified. This part of \.{GFtype} requires nonstandard
\PASCAL\ constructions to handle the online interaction; so it may be
preferable in some cases to omit the dialog and simply to stick to the
default options ($\\{wants\_mnemonics}=\\{wants\_pixels}=\\{true}$).
On other hand, the
system-dependent routines that are needed are not complicated, so it will
not be terribly difficult to introduce them.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{wants\_mnemonics}: \37\\{boolean};\C{controls mnemonic output}\6
\4\\{wants\_pixels}: \37\\{boolean};\C{controls pixel output}\par
\fi

\M26. \P$\X11:Set initial values\X\mathrel{+}\S$\6
$\\{wants\_mnemonics}\K\\{true}$;\5
$\\{wants\_pixels}\K\\{true}$;\par
\fi

\M27. The \\{input\_ln} routine waits for the user to type a line at his or her
terminal; then it puts ASCII-code equivalents for the characters on that line
into the \\{buffer} array. The \\{term\_in} file is used for terminal input,
and \\{term\_out} for terminal output.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{buffer}: \37\&{array} $[0\to\\{terminal\_line\_length}]$ \1\&{of}\5
\\{ASCII\_code};\2\6
\4\\{term\_in}: \37\\{text\_file};\C{the terminal, considered as an input file}%
\6
\4\\{term\_out}: \37\\{text\_file};\C{the terminal, considered as an output
file}\par
\fi

\M28. Since the terminal is being used for both input and output, some systems
need a special routine to make sure that the user can see a prompt message
before waiting for input based on that message. (Otherwise the message
may just be sitting in a hidden buffer somewhere, and the user will have
no idea what the program is waiting for.) We shall invoke a system-dependent
subroutine \\{update\_terminal} in order to avoid this problem.

\Y\P\D \37$\\{update\_terminal}\S\\{break}(\\{term\_out})$\C{empty the terminal
output buffer}\par
\fi

\M29. During the dialog, extensions of \.{GFtype} might treat the first blank
space in a
line as the end of that line. Therefore \\{input\_ln} makes sure that there
is always at least one blank space in \\{buffer}.

(This routine is more complex than the present implementation needs, but
it has been copied from \.{DVItype} so that system-dependent changes that
worked before will work again.)

\Y\P\4\&{procedure}\1\  \37\\{input\_ln};\C{inputs a line from the terminal}\6
\4\&{var} \37\|k: \37$0\to\\{terminal\_line\_length}$;\2\6
\&{begin} \37\\{update\_terminal};\5
$\\{reset}(\\{term\_in})$;\6
\&{if} $\\{eoln}(\\{term\_in})$ \1\&{then}\5
$\\{read\_ln}(\\{term\_in})$;\2\6
$\|k\K0$;\6
\&{while} $(\|k<\\{terminal\_line\_length})\W\R\\{eoln}(\\{term\_in})$ \1\&{do}%
\6
\&{begin} \37$\\{buffer}[\|k]\K\\{xord}[\\{term\_in}\↑]$;\5
$\\{incr}(\|k)$;\5
$\\{get}(\\{term\_in})$;\6
\&{end};\2\6
$\\{buffer}[\|k]\K\.{"\ "}$;\6
\&{end};\par
\fi

\M30. This is humdrum.

\Y\P\4\&{function}\1\  \37$\\{lower\_casify}(\|c:\\{ASCII\_code})$: \37\\{ASCII%
\_code};\2\6
\&{begin} \37\&{if} $(\|c\G\.{"A"})\W(\|c\L\.{"Z"})$ \1\&{then}\5
$\\{lower\_casify}\K\|c+\.{"a"}-\.{"A"}$\6
\4\&{else} $\\{lower\_casify}\K\|c$;\2\6
\&{end};\par
\fi

\M31. The selected options are put into global variables by the \\{dialog}
procedure, which is called just as \.{GFtype} begins.

\Y\P\4\&{procedure}\1\  \37\\{dialog};\6
\4\&{label} \37$1,\392$;\6
\4\&{var} \37\|k: \37\\{integer};\C{loop variable}\2\6
\&{begin} \37$\\{rewrite}(\\{term\_out})$;\C{prepare the terminal for output}\6
$\\{write\_ln}(\\{term\_out},\39\\{banner})$;\6
\X32:Determine whether the user \\{wants\_mnemonics}\X;\6
\X33:Determine whether the user \\{wants\_pixels}\X;\6
\X34:Print all the selected options\X;\6
\&{end};\par
\fi

\M32. \P$\X32:Determine whether the user \\{wants\_mnemonics}\X\S$\6
\41: \37$\\{write}(\\{term\_out},\39\.{\'Mnemonic\ output?\ (default=yes,\ ?\
for\ help):\ \'})$;\5
$\\{wants\_mnemonics}\K\\{true}$;\5
\\{input\_ln};\5
$\\{buffer}[0]\K\\{lower\_casify}(\\{buffer}[0])$;\6
\&{if} $\\{buffer}[0]\I\.{"?"}$ \1\&{then}\5
$\\{wants\_mnemonics}\K(\\{buffer}[0]=\.{"y"})\V(\\{buffer}[0]=\.{"1"})\V(%
\\{buffer}[0]=\.{"t"})\V(\\{buffer}[0]=\.{"\ "})$\6
\4\&{else} \&{begin} \37$\\{write}(\\{term\_out},\39\.{\'Type\ Y\ for\ complete%
\ listing,\'})$;\5
$\\{write\_ln}(\\{term\_out},\39\.{\'\ N\ for\ errors/images\ only.\'})$;\5
\&{goto} \371;\6
\&{end}\2\par
\U section~31.\fi

\M33. \P$\X33:Determine whether the user \\{wants\_pixels}\X\S$\6
\42: \37$\\{write}(\\{term\_out},\39\.{\'Pixel\ output?\ (default=yes,\ ?\ for\
help):\ \'})$;\5
$\\{wants\_pixels}\K\\{true}$;\5
\\{input\_ln};\5
$\\{buffer}[0]\K\\{lower\_casify}(\\{buffer}[0])$;\6
\&{if} $\\{buffer}[0]\I\.{"?"}$ \1\&{then}\5
$\\{wants\_pixels}\K(\\{buffer}[0]=\.{"y"})\V(\\{buffer}[0]=\.{"1"})\V(%
\\{buffer}[0]=\.{"t"})\V(\\{buffer}[0]=\.{"\ "})$\6
\4\&{else} \&{begin} \37$\\{write}(\\{term\_out},\39\.{\'Type\ Y\ to\ list\
characters\ pictorially\'})$;\5
$\\{write\_ln}(\\{term\_out},\39\.{\'\ with\ *\'}\.{\'s,\ N\ to\ omit\ this\
option.\'})$;\5
\&{goto} \372;\6
\&{end}\2\par
\U section~31.\fi

\M34. After the dialog is over, we print the options so that the user
can see what \.{GFtype} thought was specified.

\Y\P$\4\X34:Print all the selected options\X\S$\6
$\\{print}(\.{\'Options\ selected:\ Mnemonic\ output\ =\ \'})$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'true\'})$\ \&{else} $\\{print}(\.{\'false\'})$;\2\6
$\\{print}(\.{\';\ pixel\ output\ =\ \'})$;\6
\&{if} $\\{wants\_pixels}$ \1\&{then}\5
$\\{print}(\.{\'true\'})$\ \&{else} $\\{print}(\.{\'false\'})$;\2\6
$\\{print\_ln}(\.{\'.\'})$\par
\U section~31.\fi

\N35.  The image array.
The definition of \.{GF} files refers to three registers,
$(x,y,z)$, which hold integer row and column numbers.  We also
need to remember \\{paint\_switch}, whose value is either \\{black}
or \\{white}.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4$\|x,\39\|y,\39\|z$: \37\\{integer};\C{current state values}\6
\4\\{paint\_switch}: \37\\{pixel};\par
\fi

\M36. We'll need a big array of pixels to hold the character image.  Each
pixel should be represented as a single bit in order to save space.
Some systems may prefer the following definitions, while others
may do better using the \\{boolean} type and boolean constants.

\Y\P\D \37$\\{white}=0$\C{could also be \\{false}}\par
\P\D \37$\\{black}=1$\C{could also be \\{true}}\par
\Y\P$\4\X8:Types in the outer block\X\mathrel{+}\S$\6
$\\{pixel}=\\{white}\to\\{black}$;\C{could also be \\{boolean}}\par
\fi

\M37. In order to allow different systems to change the \\{image} array easily
from
row-major order to column-major order (or vice versa), or to transpose it top
and bottom or left and right, we declare and access it as follows.

\Y\P\D \37$\\{image}\S\\{image\_array}[\|y,\39\|x]$\par
\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{image\_array}: \37\&{packed} \37\&{array} $[\\{bot\_pixel}\to\\{top%
\_pixel},\39\\{left\_pixel}\to\\{right\_pixel}]$ \1\&{of}\5
\\{pixel};\2\par
\fi

\M38. The values of \\{min\_x}, \\{max\_x}, \\{min\_y}, and \\{max\_y} are set
up to
define a rectangular subarray that will be used for the pixels of the
current character, based on the character boundaries stated in a
\\{boc} command. We truncate the stated bounds, if they are outside
the limits of \\{image\_array}; then we clear the subarray to all \\{white}.

(There may be a faster way to clear a subarray on particular systems,
using nonstandard extensions of \PASCAL.)

\Y\P$\4\X38:Clear the image\X\S$\6
\&{begin} \37$\\{min\_x}\K\\{min\_x\_stated}$;\ \&{if} $\\{min\_x}<\\{left%
\_pixel}$ \1\&{then}\5
$\\{min\_x}\K\\{left\_pixel}$;\2\6
$\\{max\_x}\K\\{max\_x\_stated}$;\ \&{if} $\\{max\_x}>\\{right\_pixel}$ \1%
\&{then}\5
$\\{max\_x}\K\\{right\_pixel}$;\2\6
$\\{min\_y}\K\\{min\_y\_stated}$;\ \&{if} $\\{min\_y}<\\{bot\_pixel}$ \1%
\&{then}\5
$\\{min\_y}\K\\{bot\_pixel}$;\2\6
$\\{max\_y}\K\\{max\_y\_stated}$;\ \&{if} $\\{max\_y}>\\{top\_pixel}$ \1%
\&{then}\5
$\\{max\_y}\K\\{top\_pixel}$;\2\6
$\|y\K\\{min\_y}$;\6
\&{while} $\|y\L\\{max\_y}$ \1\&{do}\6
\&{begin} \37$\|x\K\\{min\_x}$;\6
\&{while} $\|x\L\\{max\_x}$ \1\&{do}\6
\&{begin} \37$\\{image}\K\\{white}$;\5
$\\{incr}(\|x)$;\6
\&{end};\2\6
$\\{incr}(\|y)$;\6
\&{end};\2\6
\&{end}\par
\U section~69.\fi

\M39. As we paint the pixels of a character, we will record its actual
boundaries in variables \\{min\_x\_observed}, \\{max\_x\_observed}, etc.
Then the following routine will be called on to output the image,
using blanks for \\{white} and asterisks for \\{black}. Blanks are
emitted only when they are followed by nonblanks, in order to conserve
space in the output. Further compaction could be achieved on many
systems by using tab marks.

An integer variable \|n will be declared for use in counting blanks.

\Y\P$\4\X39:Print the image\X\S$\6
\&{begin} \37\X41:Compare the subarray boundaries with the observed boundaries%
\X;\6
$\|y\K\\{max\_y}$;\6
\&{while} $\|y\G\\{min\_y}$ \1\&{do}\6
\&{begin} \37$\|x\K\\{min\_x}$;\5
$\|n\K0$;\6
\&{while} $\|x\L\\{max\_x}$ \1\&{do}\6
\&{begin} \37\&{if} $\\{image}=\\{white}$ \1\&{then}\5
$\\{incr}(\|n)$\6
\4\&{else} \&{begin} \37\&{while} $\|n>0$ \1\&{do}\6
\&{begin} \37$\\{print}(\.{\'\ \'})$;\5
$\\{decr}(\|n)$;\6
\&{end};\2\6
$\\{print}(\.{\'*\'})$;\6
\&{end};\2\6
$\\{incr}(\|x)$;\6
\&{end};\2\6
\\{print\_nl};\5
$\\{decr}(\|y)$;\6
\&{end};\2\6
\&{end}\par
\U section~67.\fi

\M40. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4$\\{min\_x},\39\\{max\_x},\39\\{min\_y},\39\\{max\_y}$: \37\\{integer};%
\C{bounds of the current subarray}\6
\4$\\{min\_x\_stated},\39\\{max\_x\_stated},\39\\{min\_y\_stated},\39\\{max\_y%
\_stated}$: \37\\{integer};\C{bounds stated in the \.{GF} file}\6
\4$\\{min\_x\_observed},\39\\{max\_x\_observed},\39\\{min\_y\_observed},\39%
\\{max\_y\_observed}$: \37\\{integer};\C{bounds actually observed when
painting}\6
\4$\\{min\_x\_overall},\39\\{max\_x\_overall},\39\\{min\_y\_overall},\39\\{max%
\_y\_overall}$: \37\\{integer};\C{bounds observed in the entire file so far}\par
\fi

\M41. If the given character is substantially smaller than the \\{boc}
command predicted, we don't want to bother to output rows and columns
that are all blank.

\Y\P$\4\X41:Compare the subarray boundaries with the observed boundaries\X\S$\6
\&{if} $(\\{max\_x}<\\{max\_x\_observed})\V(\\{min\_x}>\\{min\_x\_observed})\V%
\30(\\{max\_y}<\\{max\_y\_observed})\V(\\{min\_y}>\\{min\_y\_observed})$ \1%
\&{then}\5
$\\{print\_ln}(\.{\'(The\ character\ is\ too\ large\ to\ be\ displayed\ in\
full.)\'})$;\2\6
\&{if} $\\{max\_y}>\\{max\_y\_observed}$ \1\&{then}\5
$\\{max\_y}\K\\{max\_y\_observed}$;\2\6
\&{if} $\\{min\_y}<\\{min\_y\_observed}$ \1\&{then}\5
$\\{min\_y}\K\\{min\_y\_observed}$;\2\6
\&{if} $\\{max\_x}>\\{max\_x\_observed}$ \1\&{then}\5
$\\{max\_x}\K\\{max\_x\_observed}$;\2\6
\&{if} $\\{min\_x}<\\{min\_x\_observed}$ \1\&{then}\5
$\\{min\_x}\K\\{min\_x\_observed}$;\2\6
$\\{print\_ln}(\.{\'Character\ image,\ with\ upper\ left\ corner\ at\ (\'},\39%
\\{min\_x}:1,\39\.{\',\'},\39\\{max\_y}+1:1,\39\.{\'):\'})$\par
\U section~39.\fi

\N42.  Translation to symbolic form.
The main work of \.{GFtype} is accomplished by the \\{do\_char} procedure,
which produces the output for an entire character, assuming that the \\{boc}
command for that page has already been processed. This procedure is
essentially an interpretive routine that reads and acts on the \.{GF}
commands.

\fi

\M43. We steal the following routine from \MF.

\Y\P\D \37$\\{unity}\S\O{200000}$\C{$2↑{16}$, represents 1.00000}\par
\Y\P\4\&{procedure}\1\  \37$\\{print\_scaled}(\|s:\\{integer})$;\C{prints a
scaled number, rounded to five digits}\6
\4\&{var} \37\\{delta}: \37\\{integer};\C{amount of allowable inaccuracy}\2\6
\&{begin} \37\&{if} $\|s<0$ \1\&{then}\6
\&{begin} \37$\\{print}(\.{\'-\'})$;\5
$\\{negate}(\|s)$;\C{print the sign, if negative}\6
\&{end};\2\6
$\\{print}(\|s\mathbin{\&{div}}\\{unity}:1)$;\C{print the integer part}\6
$\|s\K10\ast(\|s\mathbin{\&{mod}}\\{unity})+5$;\6
\&{if} $\|s\I5$ \1\&{then}\6
\&{begin} \37$\\{delta}\K10$;\5
$\\{print}(\.{\'.\'})$;\6
\1\&{repeat} \37\&{if} $\\{delta}>\\{unity}$ \1\&{then}\5
$\|s\K\|s+\O{100000}-(\\{delta}\mathbin{\&{div}}2)$;\C{round the final digit}\2%
\6
$\\{print}(\\{chr}(\\{ord}(\.{\'0\'})+(\|s\mathbin{\&{div}}\\{unity})))$;\5
$\|s\K10\ast(\|s\mathbin{\&{mod}}\\{unity})$;\5
$\\{delta}\K\\{delta}\ast10$;\6
\4\&{until}\5
$\|s\L\\{delta}$;\2\6
\&{end};\2\6
\&{end};\par
\fi

\M44. Let's keep track of how many characters are in the font, and the
locations of where each one occured in the file.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{total\_chars}: \37\\{integer};\C{the total number of characters seen so
far}\6
\4\\{char\_ptr}: \37\&{array} $[0\to255]$ \1\&{of}\5
\\{integer};\C{correct character location pointer}\2\6
\4\\{gf\_prev\_ptr}: \37\\{integer};\C{\\{char\_ptr} for next character}\6
\4\\{character\_code}: \37\\{integer};\C{current character number}\par
\fi

\M45. \P$\X11:Set initial values\X\mathrel{+}\S$\6
\&{for} $\|i\K0\mathrel{\&{to}}255$ \1\&{do}\5
$\\{char\_ptr}[\|i]\K-1$;\C{mark characters as not being in the file}\2\6
$\\{total\_chars}\K0$;\par
\fi

\M46. Before we get into the details of \\{do\_char}, it is convenient to
consider a simpler routine that computes the first parameter of each
opcode.

\Y\P\D \37$\\{three\_cases}(\#)\S\#,\39\#+1,\39\#+2$\par
\P\D \37$\\{four\_cases}(\#)\S\#,\39\#+1,\39\#+2,\39\#+3$\par
\P\D \37$\\{eight\_cases}(\#)\S\\{four\_cases}(\#),\39\\{four\_cases}(\#+4)$\par
\P\D \37$\\{nine\_cases}(\#)\S\\{eight\_cases}(\#),\39\#+8$\par
\P\D \37$\\{sixteen\_cases}(\#)\S\\{eight\_cases}(\#),\39\\{eight\_cases}(%
\#+8)$\par
\P\D \37$\\{nineteen\_cases}(\#)\S\\{nine\_cases}(\#),\39\\{nine\_cases}(\#+9),%
\39\#+18$\par
\P\D \37$\\{thirty\_two\_cases}(\#)\S\\{sixteen\_cases}(\#),\39\\{sixteen%
\_cases}(\#+16)$\par
\P\D \37$\\{sixty\_four\_cases}(\#)\S\\{thirty\_two\_cases}(\#),\39\\{thirty%
\_two\_cases}(\#+32)$\par
\P\D \37$\\{eighty\_three\_cases}(\#)\S\\{sixty\_four\_cases}(\#),\39%
\\{nineteen\_cases}(\#+64)$\par
\Y\P\4\&{function}\1\  \37$\\{first\_par}(\|o:\\{eight\_bits})$: \37%
\\{integer};\2\6
\&{begin} \37\&{case} $\|o$ \1\&{of}\6
\4$\\{sixty\_four\_cases}(\\{paint\_0})$: \37$\\{first\_par}\K\|o-\\{paint%
\_0}$;\6
\4$\\{paint1},\39\\{skip1},\39\\{char\_loc},\39\\{xxx1}$: \37$\\{first\_par}\K%
\\{get\_byte}$;\6
\4$\\{paint1}+1,\39\\{skip1}+1,\39\\{xxx1}+1$: \37$\\{first\_par}\K\\{get\_two%
\_bytes}$;\6
\4$\\{paint1}+2,\39\\{skip1}+2,\39\\{xxx1}+2$: \37$\\{first\_par}\K\\{get%
\_three\_bytes}$;\6
\4$\\{new\_row},\39\\{xxx1}+3,\39\\{yyy}$: \37$\\{first\_par}\K\\{signed%
\_quad}$;\6
\4$\\{nop},\39\\{boc},\39\\{eoc},\39\\{pre},\39\\{post},\39\\{post\_post},\39%
\\{undefined\_commands}$: \37$\\{first\_par}\K0$;\6
\4$\\{eighty\_three\_cases}(\\{left\_z\_83}),\39\\{right\_z\_0},\39\\{eighty%
\_three\_cases}(\\{right\_z\_1})$: \37$\\{first\_par}\K\|o-\\{right\_z\_0}$;\2\6
\&{end};\6
\&{end};\par
\fi

\M47. Strictly speaking, the \\{do\_char} procedure is really a function with
side effects, not a `\&{procedure}'\thinspace; it returns the value \\{false}
if \.{GFtype} should be aborted because of some unusual happening. The
subroutine is organized as a typical interpreter, with a multiway branch
on the command code.

\Y\P\4\&{function}\1\  \37\\{do\_char}: \37\\{boolean};\6
\4\&{label} \37$9998,\399999$;\6
\4\&{var} \37\|o: \37\\{eight\_bits};\C{operation code of the current command}\6
$\|p,\39\|q$: \37\\{integer};\C{parameters of the current command}\2\6
\&{begin} \37\C{we've already scanned the \\{boc}}\6
$\\{do\_char}\K\\{true}$;\6
\&{while} $\\{true}$ \1\&{do}\5
\X48:Translate the next command in the \.{GF} file; \&{goto} 9999 if it was %
\\{eoc}; \&{goto} 9998 if premature termination is needed\X;\2\6
\49998: \37$\\{print\_ln}(\.{\'!\'})$;\5
$\\{do\_char}\K\\{false}$;\6
\49999: \37\&{end};\par
\fi

\M48. \P\D \37$\\{show\_label}(\#)\S\\{print}(\|a:1,\39\.{\':\ \'},\39\#)$\par
\P\D \37$\\{show\_mnemonic}(\#)\S$\1\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\6
\&{begin} \37\\{print\_nl};\5
$\\{show\_label}(\#)$;\6
\&{end}\2\2\par
\P\D \37$\\{error}(\#)\S$\1\6
\&{begin} \37$\\{show\_label}(\.{\'!\ \'},\39\#)$;\5
\\{print\_nl};\6
\&{end}\2\par
\P\D \37$\\{start\_op}\S\|a\K\\{cur\_loc}$;\5
$\|o\K\\{get\_byte}$;\5
$\|p\K\\{first\_par}(\|o)$;\6
\&{if} $\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{bad\_gf}(\.{\'the\ file\ ended\ prematurely\'})$\2\par
\Y\P$\4\X48:Translate the next command in the \.{GF} file; \&{goto} 9999 if it
was \\{eoc}; \&{goto} 9998 if premature termination is needed\X\S$\6
\&{begin} \37\\{start\_op};\5
\X49:Start translation of command \|o and \&{goto}  the appropriate label to
finish the job\X;\6
\&{end}\par
\U section~47.\fi

\M49. The multiway switch in \\{first\_par}, above, was organized by the length
of each command; the one in \\{do\_char} is organized by the semantics.

\Y\P$\4\X49:Start translation of command \|o and \&{goto}  the appropriate
label to finish the job\X\S$\6
\&{if} $\|o\L\\{paint1}+3$ \1\&{then}\5
\X54:Translate a sequence of \\{paint} commands, until reaching a non-\\{paint}%
\X;\2\6
\&{if} $(\\{new\_row}\L\|o)\W(\|o\L\\{right\_z\_83})$ \1\&{then}\5
\X57:Translate a \\{new\_row}, \\{right} or \\{left} command\X\6
\4\&{else} \&{case} $\|o$ \1\&{of}\6
\4$\\{three\_cases}(\\{skip1})$: \37\X58:Translate a \\{skip} command\X;\6
\hbox{\4}\X50:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, %
\\{boc}, and \\{eoc}\X\6
\4$\\{four\_cases}(\\{xxx1})$: \37\X51:Translate an \\{xxx} command\X;\6
\4\\{yyy}: \37\X53:Translate a \\{yyy} command\X;\6
\4\&{othercases} \37$\\{error}(\.{\'undefined\ command\ \'},\39\|o:1,\39\.{\'!%
\'})$\2\6
\&{endcases}\2\par
\U section~48.\fi

\M50. \P$\X50:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, %
\\{boc}, and \\{eoc}\X\S$\6
\4\\{nop}: \37$\\{show\_mnemonic}(\.{\'nop\'})$;\6
\4\\{pre}: \37\&{begin} \37$\\{error}(\.{\'preamble\ command\ within\ a\
character!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4$\\{post},\39\\{post\_post}$: \37\&{begin} \37$\\{error}(\.{\'postamble\
command\ within\ a\ character!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4\\{boc}: \37\&{begin} \37$\\{error}(\.{\'boc\ occurred\ before\ eoc!\'})$;\5
\&{goto} \379998;\6
\&{end};\6
\4\\{eoc}: \37\&{begin} \37$\\{show\_mnemonic}(\.{\'eoc\'})$;\5
\\{print\_nl};\5
\&{goto} \379999;\6
\&{end};\par
\U section~49.\fi

\M51. \P$\X51:Translate an \\{xxx} command\X\S$\6
\&{begin} \37$\\{show\_mnemonic}(\.{\'xxx\ \'}\.{\'\'})$;\5
$\\{bad\_char}\K\\{false}$;\5
$\|n\K16$;\6
\&{if} $\|p<0$ \1\&{then}\5
$\\{error}(\.{\'string\ of\ negative\ length!\'})$;\2\6
\&{while} $\|p>0$ \1\&{do}\6
\&{begin} \37$\|q\K\\{get\_byte}$;\6
\&{if} $(\|q<\.{"\ "})\V(\|q>\.{"\~"})$ \1\&{then}\5
$\\{bad\_char}\K\\{true}$;\2\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\6
\&{begin} \37$\\{print}(\\{xchr}[\|q])$;\6
\&{if} $\|n<\\{line\_length}$ \1\&{then}\5
$\\{incr}(\|n)$\6
\4\&{else} \&{begin} \37\\{print\_nl};\5
$\|n\K2$;\6
\&{end};\2\6
\&{end};\2\6
$\\{decr}(\|p)$;\6
\&{end};\2\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'\'}\.{\'\'})$;\2\6
\&{if} $\\{bad\_char}$ \1\&{then}\5
$\\{error}(\.{\'non-ASCII\ character\ in\ xxx\ command!\'})$;\2\6
\&{end}\par
\U sections~49 and~68.\fi

\M52. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\\{bad\_char}: \37\\{boolean};\C{has a non-ASCII character code appeared in
this \\{xxx}?}\par
\fi

\M53. \P$\X53:Translate a \\{yyy} command\X\S$\6
\&{begin} \37$\\{show\_mnemonic}(\.{\'yyy\ \'},\39\|p:1,\39\.{\'\ (\'})$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\6
\&{begin} \37$\\{print\_scaled}(\|p)$;\5
$\\{print}(\.{\')\'})$;\6
\&{end};\2\6
\&{end}\par
\U sections~49 and~68.\fi

\M54. The bulk of a \.{GF} file generally consists of \\{paint} commands,
so we collect them together and print them in an abbreviated format
on one line.

\Y\P$\4\X54:Translate a sequence of \\{paint} commands, until reaching a non-%
\\{paint}\X\S$\6
\&{begin} \37\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'\ paint\ \'})$;\2\6
\1\&{repeat} \37\X55:Paint the next \|p pixels\X;\6
\\{start\_op};\6
\4\&{until}\5
$\|o>\\{paint1}+3$;\2\6
\&{end}\par
\U section~49.\fi

\M55. \P$\X55:Paint the next \|p pixels\X\S$\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\6
\&{if} $\\{paint\_switch}=\\{white}$ \1\&{then}\5
$\\{print}(\.{\'(\'},\39\|p:1,\39\.{\')\'})$\ \&{else} $\\{print}(\|p:1)$;\2\2\6
\&{if} $\|p>0$ \1\&{then}\6
\&{begin} \37\&{if} $\|y>\\{max\_y\_observed}$ \1\&{then}\5
$\\{max\_y\_observed}\K\|y$;\2\6
\&{if} $\|y<\\{min\_y\_observed}$ \1\&{then}\5
$\\{min\_y\_observed}\K\|y$;\2\6
$\|l\K\|x$;\5
$\|r\K\|x+\|p-1$;\6
\&{if} $\|r>\\{max\_x\_observed}$ \1\&{then}\5
$\\{max\_x\_observed}\K\|r$;\2\6
\&{if} $\|l<\\{min\_x\_observed}$ \1\&{then}\5
$\\{min\_x\_observed}\K\|l$;\2\6
\&{if} $\\{wants\_pixels}$ \1\&{then}\5
\X56:Paint pixels \|l through \|r in row \|y of the subarray\X;\2\6
$\|x\K\|r+1$;\6
\&{end};\2\6
$\\{paint\_switch}\K\\{white}+\\{black}-\\{paint\_switch}$\C{could also be $%
\\{paint\_switch}\K\R\\{paint\_switch}$}\par
\U section~54.\fi

\M56. \P$\X56:Paint pixels \|l through \|r in row \|y of the subarray\X\S$\6
\&{if} $\|y\L\\{max\_y}$ \1\&{then}\6
\&{if} $\|y\G\\{min\_y}$ \1\&{then}\6
\&{begin} \37\&{if} $\|l<\\{min\_x}$ \1\&{then}\5
$\|l\K\\{min\_x}$;\2\6
\&{if} $\|r>\\{max\_x}$ \1\&{then}\5
$\|r\K\\{max\_x}$;\2\6
$\|x\K\|l$;\6
\&{while} $\|x\L\|r$ \1\&{do}\6
\&{begin} \37$\\{image}\K\\{paint\_switch}$;\5
$\\{incr}(\|x)$;\6
\&{end};\2\6
\&{end}\2\2\par
\U section~55.\fi

\M57. \P$\X57:Translate a \\{new\_row}, \\{right} or \\{left} command\X\S$\6
\&{begin} \37$\\{show\_mnemonic}(\.{\'newrow\ \'},\39\|p:1)$;\5
$\\{decr}(\|y)$;\5
$\|z\K\|z+\|p$;\5
$\|x\K\|z$;\5
$\\{paint\_switch}\K\\{black}$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'\ (y=\'},\39\|y:1,\39\.{\',\ z=\'},\39\|z:1,\39\.{\')\'})$;\2\6
\&{end}\par
\U section~49.\fi

\M58. \P$\X58:Translate a \\{skip} command\X\S$\6
\&{begin} \37$\\{show\_mnemonic}(\.{\'skip\'},\39\|o-\\{skip1}+1:1,\39\.{\'\ %
\'},\39\|p:1)$;\5
$\|y\K\|y-(\|p+1)$;\5
$\|x\K\|z$;\5
$\\{paint\_switch}\K\\{black}$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'\ (y=\'},\39\|y:1,\39\.{\',\ z=\'},\39\|z:1,\39\.{\')\'})$;\2\6
\&{end}\par
\U section~49.\fi

\N59.  Reading the postamble.
Now imagine that we are reading the \.{GF} file and positioned just
after the \\{post} command. That, in fact, is the situation,
when the following part of \.{GFtype} is called upon to read, translate,
and check the rest of the postamble.

\Y\P\4\&{procedure}\1\  \37\\{read\_postamble};\6
\4\&{var} \37\|k: \37\\{integer};\C{loop index}\6
$\|p,\39\|q,\39\|m,\39\|v,\39\|w,\39\|c$: \37\\{integer};\C{general purpose
registers}\2\6
\&{begin} \37$\\{post\_loc}\K\\{cur\_loc}-1$;\5
$\\{print}(\.{\'Postamble\ starts\ at\ byte\ \'},\39\\{post\_loc}:1)$;\6
\&{if} $\\{post\_loc}=\\{gf\_prev\_ptr}$ \1\&{then}\5
$\\{print\_ln}(\.{\'.\'})$\6
\4\&{else} $\\{print\_ln}(\.{\',\ after\ special\ info\ at\ byte\ \'},\39\\{gf%
\_prev\_ptr}:1,\39\.{\'.\'})$;\2\6
$\|p\K\\{signed\_quad}$;\6
\&{if} $\|p\I\\{gf\_prev\_ptr}$ \1\&{then}\5
$\\{error}(\.{\'backpointer\ in\ byte\ \'},\39\\{cur\_loc}-4:1,\39\.{\'\ should%
\ be\ \'},\39\\{gf\_prev\_ptr}:1,\39\.{\'\ not\ \'},\39\|p:1,\39\.{\'!\'})$;\2\6
$\\{design\_size}\K\\{signed\_quad}$;\5
$\\{check\_sum}\K\\{signed\_quad}$;\6
$\\{print}(\.{\'design\ size\ =\ \'},\39\\{design\_size}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{design\_size}\mathbin{\&{div}}16)$;\5
$\\{print\_ln}(\.{\'pt)\'})$;\5
$\\{print\_ln}(\.{\'check\ sum\ =\ \'},\39\\{check\_sum}:1)$;\6
$\\{hppp}\K\\{signed\_quad}$;\5
$\\{vppp}\K\\{signed\_quad}$;\6
$\\{print}(\.{\'hppp\ =\ \'},\39\\{hppp}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{hppp})$;\5
$\\{print\_ln}(\.{\')\'})$;\5
$\\{print}(\.{\'vppp\ =\ \'},\39\\{vppp}:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\\{vppp})$;\5
$\\{print\_ln}(\.{\')\'})$;\5
$\\{min\_x\_stated}\K\\{signed\_quad}$;\5
$\\{max\_x\_stated}\K\\{signed\_quad}$;\5
$\\{min\_y\_stated}\K\\{signed\_quad}$;\5
$\\{max\_y\_stated}\K\\{signed\_quad}$;\6
$\\{print\_ln}(\.{\'min\ x\ =\ \'},\39\\{min\_x\_stated}:1,\39\.{\',\ max\ x\ =%
\ \'},\39\\{max\_x\_stated}:1)$;\6
\&{if} $\\{min\_x\_stated}>\\{min\_x\_overall}$ \1\&{then}\5
$\\{error}(\.{\'min\ x\ should\ be\ <=\'},\39\\{min\_x\_overall}:1,\39\.{\'!%
\'})$;\2\6
\&{if} $\\{max\_x\_stated}<\\{max\_x\_overall}$ \1\&{then}\5
$\\{error}(\.{\'max\ x\ should\ be\ >=\'},\39\\{max\_x\_overall}:1,\39\.{\'!%
\'})$;\2\6
$\\{print\_ln}(\.{\'min\ y\ =\ \'},\39\\{min\_y\_stated}:1,\39\.{\',\ max\ y\ =%
\ \'},\39\\{max\_y\_stated}:1)$;\6
\&{if} $\\{min\_y\_stated}>\\{min\_y\_overall}$ \1\&{then}\5
$\\{error}(\.{\'min\ y\ should\ be\ <=\'},\39\\{min\_y\_overall}:1,\39\.{\'!%
\'})$;\2\6
\&{if} $\\{max\_y\_stated}<\\{max\_y\_overall}$ \1\&{then}\5
$\\{error}(\.{\'max\ y\ should\ be\ >=\'},\39\\{max\_y\_overall}:1,\39\.{\'!%
\'})$;\2\6
\X63:Process the character locations in the postamble\X;\6
\X62:Make sure that the end of the file is well-formed\X;\6
\&{end};\par
\fi

\M60. \P$\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4$\\{design\_size},\39\\{check\_sum}$: \37\\{integer};\C{\.{TFM}-oriented
parameters}\6
\4$\\{hppp},\39\\{vppp}$: \37\\{integer};\C{magnification-oriented parameters}\6
\4\\{post\_loc}: \37\\{integer};\C{location of the \\{post} command}\par
\fi

\M61. \P$\X11:Set initial values\X\mathrel{+}\S$\6
$\\{min\_x\_overall}\K\\{max\_int}$;\5
$\\{max\_x\_overall}\K-\\{max\_int}$;\5
$\\{min\_y\_overall}\K\\{max\_int}$;\5
$\\{max\_y\_overall}\K-\\{max\_int}$;\par
\fi

\M62. When we get to the present code, the \\{post\_post} command has
just been read.

\Y\P$\4\X62:Make sure that the end of the file is well-formed\X\S$\6
\&{if} $\|k\I\\{post\_post}$ \1\&{then}\5
$\\{error}(\.{\'should\ be\ postpost!\'})$;\2\6
$\|q\K\\{signed\_quad}$;\6
\&{if} $\|q\I\\{post\_loc}$ \1\&{then}\5
$\\{error}(\.{\'postamble\ pointer\ should\ be\ \'},\39\\{post\_loc}:1,\39\.{\'%
\ not\ \'},\39\|q:1)$;\2\6
$\|m\K\\{get\_byte}$;\6
\&{if} $\|m\I\\{gf\_id\_byte}$ \1\&{then}\5
$\\{error}(\.{\'identification\ byte\ should\ be\ \'},\39\\{gf\_id\_byte}:1)$;%
\2\6
$\|k\K\\{cur\_loc}$;\5
$\|m\K223$;\6
\&{while} $(\|m=223)\W\R\\{eof}(\\{gf\_file})$ \1\&{do}\5
$\|m\K\\{get\_byte}$;\2\6
\&{if} $\R\\{eof}(\\{gf\_file})$ \1\&{then}\5
$\\{bad\_gf}(\.{\'signature\ in\ byte\ \'},\39\\{cur\_loc}-1:1,\39\.{\'\ should%
\ be\ 223\'})$\6
\4\&{else} \&{if} $\\{cur\_loc}<\|k+4$ \1\&{then}\5
$\\{error}(\.{\'not\ enough\ signature\ bytes\ at\ end\ of\ file!\'})$;\2\2\par
\U section~59.\fi

\M63. \P$\X63:Process the character locations in the postamble\X\S$\6
\1\&{repeat} \37$\|k\K\\{get\_byte}$;\6
\&{if} $\|k=\\{char\_loc}$ \1\&{then}\6
\&{begin} \37$\|c\K\\{first\_par}(\\{char\_loc})$;\5
$\|v\K\\{signed\_quad}$;\5
$\|w\K\\{signed\_quad}$;\5
$\|p\K\\{signed\_quad}$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\6
\&{begin} \37$\\{print}(\.{\'Character\ \'},\39\|c:1,\39\.{\':\ device\ width\ %
\'},\39\|v:1,\39\.{\',\ width\ \'},\39\|w:1,\39\.{\'\ (\'})$;\5
$\\{print\_scaled}(\|w\mathbin{\&{div}}16)$;\5
$\\{print\_ln}(\.{\'ds),\ location\ \'},\39\|p:1)$;\6
\&{end};\2\6
\&{if} $\|p\I\\{char\_ptr}[\|c]$ \1\&{then}\5
$\\{error}(\.{\'character\ location\ should\ be\ \'},\39\\{char\_ptr}[\|c]:1,%
\39\.{\'!\'})$;\2\6
$\|k\K\\{nop}$;\6
\&{end};\2\6
\4\&{until}\5
$\|k\I\\{nop}$;\2\par
\U section~59.\fi

\N64.  The main program.
Now we are ready to put it all together. This is where \.{GFtype} starts,
and where it ends.

\Y\P\&{begin} \37\\{initialize};\C{get all variables initialized}\6
\\{dialog};\C{set up all the options}\6
\X66:Process the preamble\X;\6
\X67:Translate all the characters\X;\6
\\{print\_nl};\5
\\{read\_postamble};\5
$\\{print}(\.{\'The\ file\ had\ \'},\39\\{total\_chars}:1,\39\.{\'\ character%
\'})$;\6
\&{if} $\\{total\_chars}\I1$ \1\&{then}\5
$\\{print}(\.{\'s\'})$;\2\6
$\\{print}(\.{\'\ altogether.\'})$;\6
\4\\{final\_end}: \37\&{end}.\par
\fi

\M65. The main program needs a few global variables in order to do its work.

\Y\P$\4\X10:Globals in the outer block\X\mathrel{+}\S$\6
\4\|a: \37\\{integer};\C{byte number of the current command}\6
\4$\|c,\39\|l,\39\|m,\39\|n,\39\|o,\39\|p,\39\|q,\39\|r$: \37\\{integer};%
\C{general purpose registers}\par
\fi

\M66. \.{GFtype} looks at the preamble in order to do error checking, and to
display the introductory comment.

\Y\P$\4\X66:Process the preamble\X\S$\6
\\{open\_gf\_file};\5
$\|o\K\\{get\_byte}$;\C{fetch the first byte}\6
\&{if} $\|o\I\\{pre}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'First\ byte\ isn\'}\.{\'t\ start\ of\ preamble!\'})$;\2\6
$\|o\K\\{get\_byte}$;\C{fetch the identification byte}\6
\&{if} $\|o\I\\{gf\_id\_byte}$ \1\&{then}\5
$\\{error}(\.{\'identification\ byte\ should\ be\ \'},\39\\{gf\_id\_byte}:1,\39%
\.{\'\ not\ \'},\39\|o:1,\39\.{\'!\'})$;\2\6
$\|o\K\\{get\_byte}$;\C{fetch the length of the introductory comment}\6
$\\{print}(\.{\'\'}\.{\'\'})$;\6
\&{while} $\|o>0$ \1\&{do}\6
\&{begin} \37$\\{decr}(\|o)$;\5
$\\{print}(\\{xchr}[\\{get\_byte}])$;\6
\&{end};\2\6
$\\{print\_ln}(\.{\'\'}\.{\'\'})$;\par
\U section~64.\fi

\M67. \P$\X67:Translate all the characters\X\S$\6
\1\&{repeat} \37$\\{gf\_prev\_ptr}\K\\{cur\_loc}$;\5
\X68:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X;\6
\&{if} $\|o\I\\{post}$ \1\&{then}\6
\&{begin} \37\&{if} $\|o\I\\{boc}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'byte\ \'},\39\\{cur\_loc}-1:1,\39\.{\'\ is\ not\ boc\ (\'},%
\39\|o:1,\39\.{\')\'})$;\2\6
\\{print\_nl};\5
$\\{print}(\\{cur\_loc}-1:1,\39\.{\':\ beginning\ of\ char\ \'})$;\5
\X69:Pass a \\{boc} command\X;\6
\&{if} $\R\\{do\_char}$ \1\&{then}\5
$\\{bad\_gf}(\.{\'char\ ended\ unexpectedly\'})$;\2\6
\X70:Pass an \\{eoc} command\X;\6
\&{if} $\\{wants\_pixels}$ \1\&{then}\5
\X39:Print the image\X;\2\6
\&{end};\2\6
\4\&{until}\5
$\|o=\\{post}$;\2\par
\U section~64.\fi

\M68. \P$\X68:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X\S$\6
\1\&{repeat} \37\\{start\_op};\6
\&{if} $\|o=\\{yyy}$ \1\&{then}\6
\&{begin} \37\X53:Translate a \\{yyy} command\X;\6
$\|o\K\\{nop}$;\6
\&{end}\6
\4\&{else} \&{if} $(\|o\G\\{xxx1})\W(\|o\L\\{xxx1}+3)$ \1\&{then}\6
\&{begin} \37\X51:Translate an \\{xxx} command\X;\6
$\|o\K\\{nop}$;\6
\&{end}\6
\4\&{else} \&{if} $\|o=\\{nop}$ \1\&{then}\5
$\\{show\_mnemonic}(\.{\'nop\'})$;\2\2\2\6
\4\&{until}\5
$\|o\I\\{nop}$;\2\par
\U section~67.\fi

\M69. \P$\X69:Pass a \\{boc} command\X\S$\6
$\|a\K\\{cur\_loc}$;\5
$\\{incr}(\\{total\_chars})$;\5
$\\{character\_code}\K\\{signed\_quad}$;\5
$\|p\K\\{signed\_quad}$;\5
$\|c\K\\{character\_code}\mathbin{\&{mod}}256$;\6
\&{if} $\|c<0$ \1\&{then}\5
$\|c\K\|c+256$;\2\6
$\\{print}(\|c:1)$;\6
\&{if} $\\{character\_code}\I\|c$ \1\&{then}\5
$\\{print}(\.{\'\ in\ family\ \'},\39(\\{character\_code}-\|c)\mathbin{%
\&{div}}256:1)$;\2\6
$\\{min\_x\_stated}\K\\{signed\_quad}$;\5
$\\{max\_x\_stated}\K\\{signed\_quad}$;\5
$\\{min\_y\_stated}\K\\{signed\_quad}$;\5
$\\{max\_y\_stated}\K\\{signed\_quad}$;\5
$\|z\K\\{signed\_quad}$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print\_ln}(\.{\':\ \'},\39\\{min\_x\_stated}:1,\39\.{\'<=x<\'},\39\\{max\_x%
\_stated}+1:1,\39\.{\'\ \'},\39\\{min\_y\_stated}:1,\39\.{\'<=y<\'},\39\\{max%
\_y\_stated}+1:1)$;\2\6
$\\{min\_x\_observed}\K\\{max\_int}$;\5
$\\{max\_x\_observed}\K-\\{max\_int}$;\5
$\\{min\_y\_observed}\K\\{max\_int}$;\5
$\\{max\_y\_observed}\K-\\{max\_int}$;\6
\&{if} $\\{char\_ptr}[\|c]\I\|p$ \1\&{then}\5
$\\{error}(\.{\'previous\ character\ pointer\ should\ be\ \'},\39\\{char\_ptr}[%
\|c]:1,\39\.{\',\ not\ \'},\39\|p:1,\39\.{\'!\'})$\6
\4\&{else} \&{if} $\|p>0$ \1\&{then}\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print\_ln}(\.{\'(previous\ character\ with\ the\ same\ code\ started\ at\
byte\ \'},\39\|p:1,\39\.{\')\'})$;\2\2\2\6
$\\{char\_ptr}[\|c]\K\\{gf\_prev\_ptr}$;\6
\&{if} $\\{wants\_mnemonics}$ \1\&{then}\5
$\\{print}(\.{\'(initially\ y=\'},\39\|y:1,\39\.{\',\ z=\'},\39\|z:1,\39\.{\')%
\'})$;\2\6
\&{if} $\\{wants\_pixels}$ \1\&{then}\5
\X38:Clear the image\X;\2\6
$\|y\K\\{max\_y\_stated}$;\5
$\|x\K\|z$;\5
$\\{paint\_switch}\K\\{black}$;\par
\U section~67.\fi

\M70. \P$\X70:Pass an \\{eoc} command\X\S$\6
\&{if} $\\{min\_x\_observed}<\\{min\_x\_overall}$ \1\&{then}\5
$\\{min\_x\_overall}\K\\{min\_x\_observed}$;\2\6
\&{if} $\\{max\_x\_observed}>\\{max\_x\_overall}$ \1\&{then}\5
$\\{max\_x\_overall}\K\\{max\_x\_observed}$;\2\6
\&{if} $\\{min\_y\_observed}<\\{min\_y\_overall}$ \1\&{then}\5
$\\{min\_y\_overall}\K\\{min\_y\_observed}$;\2\6
\&{if} $\\{max\_y\_observed}>\\{max\_y\_overall}$ \1\&{then}\5
$\\{max\_y\_overall}\K\\{max\_y\_observed}$;\2\6
\&{if} $\\{min\_x\_observed}<\\{min\_x\_stated}$ \1\&{then}\5
$\\{print\_ln}(\.{\'The\ previous\ character\ should\ have\ had\ min\ x\ <=\ %
\'},\39\\{min\_x\_observed}:1)$;\2\6
\&{if} $\\{max\_x\_observed}>\\{max\_x\_stated}$ \1\&{then}\5
$\\{print\_ln}(\.{\'The\ previous\ character\ should\ have\ had\ max\ x\ >=\ %
\'},\39\\{max\_x\_observed}+1:1)$;\2\6
\&{if} $\\{min\_y\_observed}<\\{min\_y\_stated}$ \1\&{then}\5
$\\{print\_ln}(\.{\'The\ previous\ character\ should\ have\ had\ min\ y\ <=\ %
\'},\39\\{min\_y\_observed}:1)$;\2\6
\&{if} $\\{max\_y\_observed}>\\{max\_y\_stated}$ \1\&{then}\5
$\\{print\_ln}(\.{\'The\ previous\ character\ should\ have\ had\ max\ y\ >=\ %
\'},\39\\{max\_y\_observed}+1:1)$;\2\par
\U section~67.\fi

\N71.  System-dependent changes.
This section should be replaced, if necessary, by changes to the program
that are necessary to make \.{GFtype} work at a particular installation.
It is usually best to design your change file so that all changes to
previous sections preserve the section numbering; then everybody's version
will be consistent with the printed program. More extensive changes,
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
\fi

\N72.  Index.
Pointers to error messages appear here together with the section numbers
where each ident\-i\-fier is used.
\fi


\inx
\:\|{a}, \[24], \[65].
\:\\{abort}, \[7].
\:\\{ASCII\_code}, \[8], 10, 27, 30.
\:\|{b}, \[24].
\:\.{backpointer...should be p}, 59.
\:\.{Bad GF file}, 7.
\:\\{bad\_char}, 51, \[52].
\:\\{bad\_gf}, \[7], 48, 62, 66, 67.
\:\\{banner}, \[1], 3, 31.
\:\\{black}, 14, 15, 35, \[36], 39, 55, 57, 58, 69.
\:\\{boc}, 13, 15, \[16], 18, 38, 41, 42, 46, 47, 50, 67.
\:\.{boc occurred before eoc}, 50.
\:\\{boolean}, 25, 36, 47, 52.
\:\\{bot\_pixel}, \[5], 37, 38.
\:\\{break}, 28.
\:\\{buffer}, \[27], 29, 32, 33.
\:\.{byte n is not boc}, 67.
\:\\{byte\_file}, \[20], 21.
\:\|{c}, \[24], \[30], \[59], \[65].
\:\\{char}, 9.
\:\.{char ended unexpectedly}, 67.
\:\\{char\_loc}, 15, \[16], 18, 46, 63.
\:\\{char\_ptr}, \[44], 45, 63, 69.
\:\.{character location should be...}, 63.
\:\\{character\_code}, \[44], 69.
\:\\{check\_sum}, 59, \[60].
\:{Chinese characters}, 18.
\:\\{chr}, 9, 10, 12, 43.
\:\\{cs}, \[17].
\:\\{cur\_loc}, 22, \[23], 24, 48, 59, 62, 67, 69.
\:\|{d}, \[24].
\:\\{decr}, \[6], 39, 51, 57, 66.
\:\\{delta}, \[43].
\:\\{design\_size}, 59, \[60].
\:\\{dialog}, \[31], 64.
\:\\{do\_char}, 42, 46, \[47], 49, 67.
\:\\{ds}, \[17].
\:\\{eight\_bits}, \[20], 24, 46, 47.
\:\\{eight\_cases}, \[46].
\:\\{eighty\_three\_cases}, \[46].
\:\&{else}, 2.
\:\&{end}, 2.
\:\&{endcases}, \[2].
\:\\{eoc}, 13, 15, \[16], 17, 46, 50.
\:\\{eof}, 24, 48, 62.
\:\\{eoln}, 29.
\:\\{error}, \[48], 49, 50, 51, 59, 62, 63, 66, 69.
\:\\{false}, 36, 47, 51.
\:\\{final\_end}, \[4], 7, 64.
\:\.{First byte isn't...}, 66.
\:\\{first\_par}, \[46], 48, 49, 63.
\:\\{first\_text\_char}, \[9], 12.
\:\.{Font had n characters...}, 64.
\:\\{four\_cases}, \[46], 49.
\:{Fuchs, David Raymond}, 1, 19.
\:\\{get}, 29.
\:\\{get\_byte}, \[24], 46, 48, 51, 62, 63, 66.
\:\\{get\_three\_bytes}, \[24], 46.
\:\\{get\_two\_bytes}, \[24], 46.
\:\\{gf\_file}, \[3], \[21], 22, 23, 24, 48, 62.
\:\\{gf\_id\_byte}, \[15], 62, 66.
\:\\{gf\_prev\_ptr}, \[44], 59, 67, 69.
\:\\{GF\_type}, \[3].
\:\\{hppp}, \[17], 59, \[60].
\:\|{i}, \[3].
\:\.{identification byte should be n}, 62, 66.
\:\\{image}, \[37], 38, 39, 56.
\:\\{image\_array}, 5, \[37], 38.
\:\\{incr}, \[6], 24, 29, 38, 39, 51, 56, 69.
\:\\{initialize}, \[3], 64.
\:\\{input\_ln}, 27, \[29], 32, 33.
\:\\{integer}, 3, 23, 24, 31, 35, 40, 43, 44, 46, 47, 59, 60, 65.
\:{Japanese characters}, 18.
\:\\{jump\_out}, \[7].
\:\|{k}, \[29], \[31], \[59].
\:{Knuth, Donald Ervin}, 1.
\:\|{l}, \[65].
\:\\{last\_text\_char}, \[9], 12.
\:\\{left\_pixel}, \[5], 37, 38.
\:\\{left\_z\_1}, \[15].
\:\\{left\_z\_83}, 15, \[16], 46.
\:\\{line\_length}, \[5], 51.
\:\\{lower\_casify}, \[30], 32, 33.
\:\|{m}, \[59], \[65].
\:\\{max\_int}, 61, 69.
\:\\{max\_x}, 15, \[17], 38, 39, \[40], 41, 56.
\:\\{max\_x\_observed}, 39, \[40], 41, 55, 69, 70.
\:\\{max\_x\_overall}, \[40], 59, 61, 70.
\:\\{max\_x\_stated}, 38, \[40], 59, 69, 70.
\:\\{max\_y}, 15, \[17], 38, 39, \[40], 41, 56.
\:\\{max\_y\_observed}, \[40], 41, 55, 69, 70.
\:\\{max\_y\_overall}, \[40], 59, 61, 70.
\:\\{max\_y\_stated}, 38, \[40], 59, 69, 70.
\:\\{min\_x}, 15, \[17], 38, 39, \[40], 41, 56.
\:\\{min\_x\_observed}, 39, \[40], 41, 55, 69, 70.
\:\\{min\_x\_overall}, \[40], 59, 61, 70.
\:\\{min\_x\_stated}, 38, \[40], 59, 69, 70.
\:\\{min\_y}, 15, \[17], 38, 39, \[40], 41, 56.
\:\\{min\_y\_observed}, \[40], 41, 55, 69, 70.
\:\\{min\_y\_overall}, \[40], 59, 61, 70.
\:\\{min\_y\_stated}, 38, \[40], 59, 69, 70.
\:\.{Mnemonic output?}, 32.
\:\|{n}, \[65].
\:\\{negate}, \[6], 43.
\:\\{new\_row}, 15, \[16], 46, 49.
\:\\{nine\_cases}, \[46].
\:\\{nineteen\_cases}, \[46].
\:\.{non-ASCII character...}, 51.
\:\\{nop}, 15, \[16], 18, 46, 50, 63, 68.
\:\.{not enough signature bytes...}, 62.
\:\|{o}, \[47], \[65].
\:\\{open\_gf\_file}, \[22], 66.
\:\.{Options selected}, 34.
\:\\{ord}, 10, 43.
\:{oriental characters}, 18.
\:\&{othercases}, \[2].
\:\\{others}, 2.
\:\\{output}, \[3].
\:\|{p}, \[47], \[59], \[65].
\:\\{paint}, 54.
\:\\{paint\_switch}, \[14], 15, \[35], 55, 56, 57, 58, 69.
\:\\{paint\_0}, 15, \[16], 46.
\:\\{paint1}, 15, \[16], 46, 49, 54.
\:\\{paint2}, \[15].
\:\\{paint3}, \[15].
\:\\{pixel}, 35, \[36], 37.
\:\.{Pixel output?}, 33.
\:\\{post}, 13, 15, \[16], 17, 19, 46, 50, 59, 60, 67.
\:\\{post\_loc}, 59, \[60], 62.
\:\\{post\_post}, 15, \[16], 17, 19, 46, 50, 62.
\:\.{postamble command within a page}, 50.
\:\.{postamble pointer should be...}, 62.
\:\.{Postamble starts at byte n}, 59.
\:\\{pre}, 13, 15, \[16], 46, 50, 66.
\:\.{preamble command within a page}, 50.
\:\.{previous character pointer...}, 69.
\:\\{print}, \[3], 7, 34, 39, 43, 48, 51, 53, 54, 55, 57, 58, 59, 63, 64, 66,
67, 69.
\:\\{print\_ln}, \[3], 34, 41, 47, 59, 63, 66, 69, 70.
\:\\{print\_nl}, \[3], 39, 48, 50, 51, 64, 67.
\:\\{print\_scaled}, \[43], 53, 59, 63.
\:\|{q}, \[47], \[59], \[65].
\:\|{r}, \[65].
\:\\{read}, 24.
\:\\{read\_ln}, 29.
\:\\{read\_postamble}, \[59], 64.
\:\\{reset}, 22, 29.
\:\\{rewrite}, 31.
\:\\{right\_pixel}, \[5], 37, 38.
\:\\{right\_z\_0}, 15, \[16], 46.
\:\\{right\_z\_1}, 15, \[16], 46.
\:\\{right\_z\_83}, 15, \[16], 49.
\:\|{s}, \[43].
\:\\{scaled}, 17.
\:\.{should be postpost}, 62.
\:\\{show\_label}, \[48].
\:\\{show\_mnemonic}, \[48], 50, 51, 53, 57, 58, 68.
\:\.{signature...should be...}, 62.
\:\\{signed\_quad}, \[24], 46, 59, 62, 63, 69.
\:\\{sixteen\_cases}, \[46].
\:\\{sixty\_four\_cases}, \[46].
\:\\{skip1}, 15, \[16], 46, 49, 58.
\:\\{skip2}, 15.
\:\\{skip3}, 15.
\:\\{start\_op}, \[48], 54, 68.
\:\.{string of negative length}, 51.
\:{system dependencies}, \[2], 7, 9, 19, 20, 24, 25, 27, 28, 29, 31, 36, 37,
38, 39, 71.
\:\\{term\_in}, \[27], 29.
\:\\{term\_out}, \[27], 28, 31, 32, 33.
\:\\{terminal\_line\_length}, \[5], 27, 29.
\:\\{text\_char}, \[9], 10.
\:\\{text\_file}, \[9], 27.
\:\.{The character is too large...}, 41.
\:\.{the file ended prematurely}, 48.
\:\\{thirty\_two\_cases}, \[46].
\:\\{three\_cases}, \[46], 49.
\:\\{top\_pixel}, \[5], 37, 38.
\:\\{total\_chars}, \[44], 45, 64, 69.
\:\\{true}, 25, 26, 32, 33, 36, 47, 51.
\:\.{undefined command}, 49.
\:\\{undefined\_commands}, \[16], 46.
\:\\{unity}, \[43].
\:\\{update\_terminal}, \[28], 29.
\:\|{v}, \[59].
\:\\{vppp}, \[17], 59, \[60].
\:\|{w}, \[59].
\:\\{wants\_mnemonics}, \[25], 26, 32, 34, 48, 51, 53, 54, 55, 57, 58, 63, 69.
\:\\{wants\_pixels}, \[25], 26, 33, 34, 55, 67, 69.
\:\\{white}, 35, \[36], 38, 39, 55.
\:\\{write}, 3, 32, 33.
\:\\{write\_ln}, 3, 31, 32, 33.
\:\|{x}, \[35].
\:\\{xchr}, \[10], 11, 12, 51, 66.
\:\\{xord}, \[10], 12, 29.
\:\\{xxx1}, 15, \[16], 46, 49, 68.
\:\\{xxx2}, \[15].
\:\\{xxx3}, 15.
\:\\{xxx4}, \[15].
\:\|{y}, \[35].
\:\\{yyy}, 15, \[16], 18, 46, 49, 68.
\:\|{z}, \[35].
\fin
\:\X50:Cases for commands \\{nop}, \\{pre}, \\{post}, \\{post\_post}, \\{boc},
and \\{eoc}\X
\U section~49.
\:\X38:Clear the image\X
\U section~69.
\:\X41:Compare the subarray boundaries with the observed boundaries\X
\U section~39.
\:\X5:Constants in the outer block\X
\U section~3.
\:\X32:Determine whether the user \\{wants\_mnemonics}\X
\U section~31.
\:\X33:Determine whether the user \\{wants\_pixels}\X
\U section~31.
\:\X10, 21, 23, 25, 27, 35, 37, 40, 44, 52, 60, 65:Globals in the outer block\X
\U section~3.
\:\X4:Labels in the outer block\X
\U section~3.
\:\X62:Make sure that the end of the file is well-formed\X
\U section~59.
\:\X56:Paint pixels \|l through \|r in row \|y of the subarray\X
\U section~55.
\:\X55:Paint the next \|p pixels\X
\U section~54.
\:\X69:Pass a \\{boc} command\X
\U section~67.
\:\X70:Pass an \\{eoc} command\X
\U section~67.
\:\X68:Pass \\{nop}, \\{xxx} and \\{yyy} commands\X
\U section~67.
\:\X34:Print all the selected options\X
\U section~31.
\:\X39:Print the image\X
\U section~67.
\:\X63:Process the character locations in the postamble\X
\U section~59.
\:\X66:Process the preamble\X
\U section~64.
\:\X11, 12, 26, 45, 61:Set initial values\X
\U section~3.
\:\X49:Start translation of command \|o and \&{goto}  the appropriate label to
finish the job\X
\U section~48.
\:\X54:Translate a sequence of \\{paint} commands, until reaching a non-%
\\{paint}\X
\U section~49.
\:\X57:Translate a \\{new\_row}, \\{right} or \\{left} command\X
\U section~49.
\:\X58:Translate a \\{skip} command\X
\U section~49.
\:\X53:Translate a \\{yyy} command\X
\U sections~49 and~68.
\:\X67:Translate all the characters\X
\U section~64.
\:\X51:Translate an \\{xxx} command\X
\U sections~49 and~68.
\:\X48:Translate the next command in the \.{GF} file; \&{goto} 9999 if it was %
\\{eoc}; \&{goto} 9998 if premature termination is needed\X
\U section~47.
\:\X8, 9, 20, 36:Types in the outer block\X
\U section~3.
\con